460 IF ADDR.REF$(COUNTER)<=ADDR.REF$(COUNTER+D) THEN 520 ELSE T$=ADDR.REF$(COUNTER+D):ADDR.REF$(COUNTER+D)=ADDR.REF$(COUNTER)
470 IF COUNTER<=D THEN ADDR.REF$(COUNTER)=T$:GOTO 520
480 FOR J=COUNTER-D TO 1 STEP -D
490 IF T$>=ADDR.REF$(J) THEN 510 ELSE ADDR.REF$(J+D)=ADDR.REF$(J)
500 NEXT J
510 ADDR.REF$(J+D)=T$
520 NEXT COUNTER
530 D=INT(D/2):IF D>0 THEN 450 ELSE COUNTER = 1
540 IF COUNTER=ADDR.REF THEN 600
550 IF ADDR.REF$(COUNTER)=ADDR.REF$(COUNTER+1) THEN FOR J = COUNTER TO ADDR.REF:ADDR.REF$(J)=ADDR.REF$(J+1):NEXT:ADDR.REF=ADDR.REF-1 ELSE COUNTER = COUNTER+1